<template>
    <div class="l-from-body" >
        <el-form :model="formData" :rules="rules" size="mini"  ref="form" label-width="60px" >
            <el-col :span="24" v-if="lr_hasPageAuth('f_EnCode')">
                <el-form-item label="编号" prop="f_EnCode" >
                    <el-input v-model="formData.f_EnCode"></el-input>
                </el-form-item>
            </el-col>
            <el-col :span="24" v-if="lr_hasPageAuth('f_FullName')">
                <el-form-item label="名称" prop="f_FullName" >
                    <el-input v-model="formData.f_FullName"></el-input>
                </el-form-item>
            </el-col>
            <el-col :span="24" v-if="lr_hasPageAuth('f_EnabledMark')" >
                <el-form-item label="状态" prop="f_EnabledMark" >
                        <el-switch
                        :active-value="1"
                        :inactive-value="0"
                        v-model="formData.f_EnabledMark"
                        >
                    </el-switch>
                </el-form-item>
            </el-col>
            <el-col :span="24" v-if="lr_hasPageAuth('f_Description')">
                <el-form-item label="描述" prop="f_Description" >
                    <el-input type="textarea" v-model="formData.f_Description"></el-input>
                </el-form-item>
            </el-col>
        </el-form>
    </div>
</template>
<script>
export default {
    data(){
        return {
            formData:{
                f_EnCode:'',
                f_FullName:'',
                f_EnabledMark:1,
                f_Description:''
            },
            rules: {
                f_EnCode: [
                    { required: true, message: '请输入编号' },
                    { validator: this.lr_existDbFiled,keyValue:() => { return this.formData.f_RoleId },tableName:'lr_base_role',keyName:'f_RoleId',trigger: 'blur'}
                ],
                f_FullName: [
                    { required: true, message: '请输入名称' }
                ]
            }
        };
    },
    created () {
    },
    methods:{
        resetForm(){
            this.formData.f_RoleId = ''
            this.$formClear(this.$refs.form)
        },
        // 校验表单
        validateForm(callback){
            this.$refs.form.validate((valid) => {
                if(valid){
                    callback()
                }
            })
        },
        setForm(data){
            this.formData = this.$deepClone(data)
        },
        getForm(){
            return this.$deepClone(this.formData)
        }
    }
}
</script>